package com.liang.pcc.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liang.pcc.domain.AuthUser;
import com.liang.pcc.domain.HarmonicData;
import com.liang.pcc.service.AuthUserService;
import com.liang.pcc.service.HarmonicDataService;
import com.liang.pcc.mapper.HarmonicDataMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 谐波数据表Service实现
*/
@Service
@RequiredArgsConstructor
public class HarmonicDataServiceImpl extends ServiceImpl<HarmonicDataMapper, HarmonicData> implements HarmonicDataService{

    private final AuthUserService authUserService;

    @Override
    public List<HarmonicData> getHarmonicData(Long fileId, Long pointId) {
        Long userId = authUserService.getUserIdByAccount(StpUtil.getLoginId().toString());
        return lambdaQuery()
                .eq(HarmonicData::getPointId, pointId)
                .eq(fileId != null, HarmonicData::getFileId, fileId)
                .eq(HarmonicData::getUserId, userId)
                .list();
    }
}




